From: Wei Liu Date: Tue, 14 Jul 2015 16:41:10 +0000 (+0100) Subject: xl: correct handling of extra_config in main_cpupoolcreate X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2821 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=705c9e12426cba82804cb578fc70785281655d94;p=xen.git xl: correct handling of extra_config in main_cpupoolcreate Don't dereference extra_config if it's NULL. Don't leak extra_config in the end. Also fixed a typo in error string while I was there. Signed-off-by: Wei Liu Acked-by: Ian Jackson --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 971209cc22..607db4e998 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -7228,9 +7228,9 @@ int main_cpupoolcreate(int argc, char **argv) else config_src="command line"; - if (strlen(extra_config)) { + if (extra_config && strlen(extra_config)) { if (config_len > INT_MAX - (strlen(extra_config) + 2)) { - fprintf(stderr, "Failed to attach extra configration\n"); + fprintf(stderr, "Failed to attach extra configuration\n"); goto out; } config_data = xrealloc(config_data, @@ -7365,6 +7365,7 @@ out_cfg: out: free(name); free(config_data); + free(extra_config); return rc; }